<?php

require_once '../config.php';

require_once '../includes/functions.php';

if ($_SERVER['REQUEST_METHOD'] === 'POST') {

    if ($_POST['username'] === ADMIN_USERNAME && $_POST['password'] === ADMIN_PASSWORD) {

        $_SESSION['admin_logged_in'] = true;

        redirect('../admin.php');

    } else {

        $_SESSION['error'] = '用户名或密码错误';

        redirect('../login.php');

    }

} else {

    redirect('../login.php');

}

?>